<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script type="text/javascript" language="javascript">

    var http_request = false;

	function displayTimepoints(shiftId) {
        document.getElementById("test").innerHTML = "<p class='basicFont' style='text-align: center; font-size: 14px; font-weight: bold;'>Loading timepoints...</p>";
		makeRequest("http://transpo.uconn.edu/includes/ajax.php?task=grabTimepoints&shiftId="+shiftId,alertContents);
	}
	

    function makeRequest(url,toWhom) {
        http_request = false;
        if (window.XMLHttpRequest) { // Mozilla, Safari,...
            http_request = new XMLHttpRequest(); 
            if (http_request.overrideMimeType) {
                http_request.overrideMimeType('text/xml');
                // See note below about this line
            }
        } else if (window.ActiveXObject) { // IE
            try {
                http_request = new ActiveXObject("Msxml2.XMLHTTP");
            } catch (e) {
                try {
                    http_request = new ActiveXObject("Microsoft.XMLHTTP");
                } catch (e) {}
            }
        }

        if (!http_request) {
            alert('Giving up :( Cannot create an XMLHTTP instance');
            return false;
        }
		
		http_request.onreadystatechange = toWhom;
        http_request.open('GET', url, true);
        http_request.send(null);
    }

    function alertContents() {
        if (http_request.readyState == 4) {
            if (http_request.status == 200) {
                document.getElementById("test").innerHTML = http_request.responseText;
            } else {
                alert('There was a problem with the request.');
            }
        }
    }

/*
    function alertContents() {
        if (http_request.readyState == 4) {
            if (http_request.status == 200) {
                document.getElementById("orderInfo").innerHTML = http_request.responseText;
            } else {
                alert('There was a problem with the request.');
            }
        }
    }

    function receiveCapture() {
        if (http_request.readyState == 4) {
            if (http_request.status == 200) {
                //perform some error checking on our result!
				if(http_request.responseText == 1) {
					alert("Order was successfully captured!");
				} else {
					alert(http_request.responseText);
				}
            } else {
                alert('There was a problem with the request.');
            }
        }
    }
    function receiveShipping() {
        if (http_request.readyState == 4) {
            if (http_request.status == 200) {
                //perform some error checking on our result!
				if(http_request.responseText == 1) {
					alert("Order was successfully shipped!");
				} else {
					alert(http_request.responseText);
				}
            } else {
                alert('There was a problem with the request.');
            }
        }
    }

    function shipOrder(orderNumber) {
		var shipConfirm = confirm("Are you sure you want to ship order " + orderNumber + "?");
		if(shipConfirm) {
			makeRequest("http://www405.pair.com/fisf/ordersHTML.php?a=ship&orderID=" + orderNumber,receiveShipping);
		}
    }
*/
</script>


</head>

<body>

<input type="button" onClick=displayTimepoints(3040) value="Grab Timepoints">
<br><br>
<div id="test">Hi</div>

</body>
</html>
